<?php

namespace common\models\base;

use Yii;

/**
 * This is the model class for table "{{%nbrb_loan_apply_back}}".
 *
 * @property int $id
 * @property string $request_seq_no
 * @property string $item_code
 * @property string $company_code
 * @property string $interface_code
 * @property string $interface_version
 * @property string $loan_apply_number
 * @property string $audit_result
 * @property string $audit_opinion
 * @property string $risk_rate
 * @property string $max_loan_amt
 * @property string $req_data
 * @property int $created_at
 * @property string $resp_data
 * @property string $resp_info_data
 *
 * @property NbrbLoanApply $loanApplyNumber
 */
class NbrbLoanApplyBack extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%nbrb_loan_apply_back}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['request_seq_no', 'item_code', 'company_code', 'interface_code', 'interface_version', 'loan_apply_number', 'audit_result', 'created_at'], 'required'],
            [['audit_opinion', 'req_data', 'resp_data', 'resp_info_data'], 'string'],
            [['max_loan_amt'], 'number'],
            [['created_at'], 'integer'],
            [['request_seq_no', 'item_code', 'company_code', 'interface_code', 'interface_version', 'loan_apply_number', 'audit_result'], 'string', 'max' => 50],
            [['risk_rate'], 'string', 'max' => 20],
            [['loan_apply_number'], 'exist', 'skipOnError' => true, 'targetClass' => NbrbLoanApply::className(), 'targetAttribute' => ['loan_apply_number' => 'loan_apply_number']],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'request_seq_no' => Yii::t('app', 'Request Seq No'),
            'item_code' => Yii::t('app', 'Item Code'),
            'company_code' => Yii::t('app', 'Company Code'),
            'interface_code' => Yii::t('app', 'Interface Code'),
            'interface_version' => Yii::t('app', 'Interface Version'),
            'loan_apply_number' => Yii::t('app', 'Loan Apply Number'),
            'audit_result' => Yii::t('app', 'Audit Result'),
            'audit_opinion' => Yii::t('app', 'Audit Opinion'),
            'risk_rate' => Yii::t('app', 'Risk Rate'),
            'max_loan_amt' => Yii::t('app', 'Max Loan Amt'),
            'req_data' => Yii::t('app', 'Req Data'),
            'created_at' => Yii::t('app', 'Created At'),
            'resp_data' => Yii::t('app', 'Resp Data'),
            'resp_info_data' => Yii::t('app', 'Resp Info Data'),
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getLoanApplyNumber()
    {
        return $this->hasOne(NbrbLoanApply::className(), ['loan_apply_number' => 'loan_apply_number']);
    }
}
